<template>
	<view class="collection">
		<view class="collection-item" v-for="v in itemsData" :key="v.id">
			<navigator url="../HouseRental/houseDetails/houseDetails" hover-class="navigator-hover">
				<view class="item-left">
					<uni-badge class="tip" :text="v.housingResource" type="primary" absolute="leftTop" :offset="[14, 5]">
						<image :src="v.housePhoto" mode=""></image>
					</uni-badge>
				</view>v.
				<view class="item-right">
					<h4>{{v.rentalWay}} {{v.houseType}}</h4>
					<text class="area">{{v.buildingArea}}</text>
					<text class="money">{{v.rent}}/月</text>
				</view>
			</navigator>
		</view>

	</view>
</template>

<script>
	import {http} from "../../utils/http.js"
	export default {
		data() {
			return {
				customStyle: {
					backgroundColor: '#62ed0d',
					color: '#fff'
				},
				itemsData: [],
				id:1
			};
		},
		methods: {
			
			getdata() {
				
				try {
					const value = uni.getStorageSync("list");
					if (value) {
						this.id = value.id
					}
				} catch (e) {
					console.log("出错了")
				}
				http({
					url: "/houseRent/list",
					method: "post",
				}).then((res) => {
					if (res.code == 0) {
						console.log(res)
						this.itemsData = res.data
					}
				})
			}
		},
		onLoad() {
			this.getdata()
		}
	}
</script>

<style lang="less" scoped>
	.collection {
		padding: 40rpx;

		.collection-item {
			padding: 26rpx;
			display: flex;
			border-radius: 8rpx;
			margin-bottom: 32rpx;
			box-shadow: 0px 0px 15rpx rgba(0, 0, 0, .2);

			navigator {
				display: flex;
			}

			.item-left {
				margin-right: 28rpx;

				image {
					width: 216rpx;
					height: 160rpx;
					border-radius: 10rpx;
				}
			}

			.item-right {
				height: 160rpx;
				display: flex;
				flex-direction: column;
				align-items: flex-start;
				justify-content: space-between;

				h4 {
					font-size: 32rpx;
					// margin-bottom: ;
				}

				.area {
					font-size: 26rpx;
					color: #a0a0a0;
				}

				.money {
					font-size: 28rpx;
					color: #f25867;
				}
			}

		}

		.example-body {
			flex-direction: row;
			justify-content: flex-start;
		}

		.uni-badge-left-margin {
			margin-left: 10px;
		}
	}
</style>


<style lang="less">
	.collection {
		.uni-badge {

			width: 128rpx !important;
			height: 46rpx !important;
			padding: 0rpx !important;
			background-color: #28d779 !important;
			color: white;
			border-radius: 10rpx !important;
			text-align: center !important;
			line-height: 44rpx !important;
			font-size: 26rpx !important;
			border: 0rpx !important;
		}
	}
</style>
